//
//  AUEssenceTopicCommentModel.swift
//  Alamofire
//
//  Created by Miss_Special on 2018/4/17.
//  评论模型

import UIKit

class AUEssenceTopicCommentModel: NSObject {
    
    @objc var voicetime: Int = 0
    @objc var status: Int = 0
    @objc var hate_count: Int = 0
    @objc var precid: Int = 0
    @objc var like_count: Int = 0
    /// 评论内容
    @objc var content: String = "" {
        didSet {
            if !content.isEmpty {
                let size = CGSize(width: UIScreen.main.bounds.size.width - 20, height: CGFloat(MAXFLOAT))
                let font = UIFont.systemFont(ofSize: 15)
                cellHeight = NSString(string: content).boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font: font], context: nil).height + 20
            }
        }
    }
    /// 类型 text
    @objc var cmt_type: String = ""
    /// 时间 2018-04-14 19:31:28
    @objc var passtime: String = ""
    /// id
    @objc var id: Int = 0
    
    var cellHeight: CGFloat = 0
    
    /// 用户信息
    var user = AUEssenceTopicUserModel(dict: [:])

    init(dict: [String: Any]) {
        super.init()
        setValuesForKeys(dict)
        
        if let userDict = dict["u"] as? [String: Any] {
            user = AUEssenceTopicUserModel(dict: userDict)
        }
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) { }
}
